package com.weilx959.spt.app.utils;

import com.weilx959.spt.app.constants.AppConstants;
import com.weilx959.spt.core.LanguageContext;
import com.weilx959.spt.core.constants.CommonConstants;

import java.util.Optional;
import java.util.ResourceBundle;

public class ResourceBundleUtil {
    private ResourceBundleUtil() {}

    public static ResourceBundle get() {
        return ResourceBundle.getBundle(AppConstants.LANGUAGE_BASE_NAME,
            Optional.ofNullable(LanguageContext.get()).orElse(CommonConstants.DEFAULT_LANGUAGE).getLocale());
    }
}
